using System;
using UnityEngine;

namespace NodeCanvas.Variables
{
	[AddComponentMenu("")]
	public class UnityObjectData : VariableData
	{
		public UnityEngine.Object value;

		[SerializeField]
		private string _typeName = typeof(UnityEngine.Object).AssemblyQualifiedName;

		private Type type
		{
			get
			{
				return (!(value != null)) ? Type.GetType(_typeName) : value.GetType();
			}
			set
			{
				_typeName = value.AssemblyQualifiedName;
				if (this.value != null && !value.NCIsAssignableFrom(this.value.GetType()))
				{
					this.value = null;
				}
			}
		}

		public override Type varType
		{
			get
			{
				return type;
			}
		}

		public override object objectValue
		{
			get
			{
				return value;
			}
			set
			{
				this.value = (UnityEngine.Object)value;
				if (value != null && !type.NCIsAssignableFrom(value.GetType()))
				{
					type = value.GetType();
				}
			}
		}
	}
}
